home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93c.txt
/
000112_icon-group-sender _Sat Dec 4 22:31:04 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1994-02-02
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 14 Dec 1993 17:09:02 MST
Article: 2309 of comp.lang.icon
Path: CS.Arizona.EDU!not-for-mail
From: nevin@cs.arizona.edu (Nevin Liber)
Newsgroups: comp.lang.icon
Subject: Re: two language questions
Date: 4 Dec 1993 22:31:04 -0700
Organization: University of Arizona CS Department, Tucson AZ
Lines: 41
Message-Id: <2drrmo$iu3@caslon.CS.Arizona.EDU>
References: <CGxEnw.Lwq@walter.bellcore.com> <CH8Dno.9IM@walter.bellcore.com> <2dd1v7$p98@caslon.cs.arizona.edu> <CHA02z.4r1@walter.bellcore.com>
Nntp-Posting-Host: caslon.cs.arizona.edu
Status: RO
Errors-To: icon-group-errors@cs.arizona.edu
Apparently-To: icon-group-addresses
In article <CHA02z.4r1@walter.bellcore.com>,
Norman Ramsey <norman@flaubert.bellcore.com> wrote:
> I, Nevin Liber, nevin@cs.arizona.edu, wrote:
NL> If you believe otherwise, please post a code fragment where you can do
NL> something useful with "inserted elements might or might not be
NL> generated" as the semantics vs "undefined" as the semantics.
NR> Under the invariant that no value in t has type integer,
NR>
NR> every type(x := !s) == "integer" do insert(s, t[x])
NR>
NR> is safe and well defined in the maybe, maybe not semantics.
You're right. I concede. If you have a way to ignore (at least) all
elements that were not in the original set (ie, degenerate the "maybe /
maybe" not semantics to the stronger "definitely not" semantics), this
is a perfectly well defined concept. Very clever.
NR> In the
NR> undefined semantics it's unsafe and I'm forced to write
NR> ss := set()
NR> every type(x := !s) == "integer" do insert(ss, t[x])
NR> every insert(s, !ss)
Actually, I would change the last line to s ++:= ss, and I would claim
that these three lines are more readable/understandable/maintainable
than the one-liner (although this is an orthogonal issue to the
original discussion), although certainly not as space-efficent.
Personally, I like code that doesn't rely on hidden dependencies (such
as the fact that t has no integer values in the above example). But I
digress.
Now that I think about it, if I needed time-efficiency, I might implement
the above three lines as:
l := list()
every "integer" == type(x := !s) do put(l, t[x])
s ++:= set(l)
--
Nevin ":-)" Liber nevin@cs.arizona.edu (602) 293-2799